I would argue that you're not reverse-engineering the software. You are just monitoring its behaviour on some data and learning from it.
Imagine the expensive software you bought is just returning y=|x|⋅x. Let's assume that your "business" involves monitoring the time duration of some processes and therefore your x is a positive number in some range. You collect a bunch of observations, then consider the pairs (xᵢ,yᵢ) and train a model on these data (it could be a neural network or any other model). Assuming you have enough data and that your model is "complex" enough, your fitted model might fit your training data perfectly. However that doesn't mean that you have reverse engineered ("identified") the original device. Your model could infer the rule y=x² or y=max(x,0)² or pretty much any other function that fits your data. In other words, unlike in traditional reverse-engineering, your "replica" of the system cannot learn to mimic the original system outside the data that you trained it on.
Let's consider another example where we now assume your data spans the whole range of admissible inputs. Imagine your device is computing and returning the standard deviation of its nine inputs. Your fitted model might be able to learn the correct mapping between the inputs and the output but it wouldn't generally know if your device computes y=sqrt(Σᵢ(xᵢ-(Σᵢxᵢ)/9)²/9) or y=sqrt((Σᵢxᵢ²)/9 -((Σᵢxᵢ)/9)²). Conversely, reverse engineering would identify exactly the procedure followed, not just the behaviour as observed from the outside. This is not a subtle distinction because many times in practice "how something is computed" is more important than "what is computed" because different methods of computing the same quantity might have different speed (and different ways the speed scales with the size of the input), different accuracies (and different ways the accuracy degrades for particular inputs), etcetera. See for example the many different ways to solve a linear system Ax=b (LU, QR, Jacobi, ...). It is not unlikely that the value (and trade secrets) of the software you are trying to mimic is exactly in the ways something is computed rather than in what is computed.
Having established that learning from behaviour is distinct from reverse-engineering, the question remains as to whether it is permissible to publish software that mimics the behaviour of another system. I think this will depend on various factors, including the terms of any licenses, laws, or agreements that govern the use of the original software. In general, if your software is developed through a process of learning from behaviour, without accessing or using any proprietary information, trade secrets, or copyrighted materials, I would think that it should not infringe on the intellectual property rights of the original software. However, IANAL ;-)